<?php
// SomeryC, a webcomic script by Zachary Weston Lewis
// Based on Somery by Robin de Graaf
// Copyright 2005-2006
// SomeryC is distributed under the Artistic License (see LICENSE.txt)
//
// COMMENTS.PHP > 31-08-2007
$c_query = "SELECT * FROM ".$prefix."comics WHERE id = '$p'";
$c_result = mysql_query($c_query);
while($c_row = mysql_fetch_object($c_result)) {
   $settings_comments = $c_row->show_comments;
}
if ($settings[comments] == 1 && $settings_comments == 1) {
   if ($c == 1) {
   include("admin/cookies.php");
   $author = read_cookie("mobscommenter");
   $email = read_cookie("mobscommentemail");
   $url = read_cookie("mobscommenturl");
   $c_query = "SELECT * FROM ".$prefix."comments WHERE parentid = '$p' ORDER BY coid";
   echo "<div id=\"commentPostArea\">";
   $c_result = mysql_query($c_query);
      while($c_row = mysql_fetch_object($c_result)) {
?>
        <div class="commentPost">
          <h2 class="commentTitle"><a href="<?php getcomment("url");?>"><?php getcomment("author");?></a> says:</h2>
          <p><?php comment();?></p>
          <div class="byline">posted on <?php getcomment("date");?> @ <?php getcomment("time");?></div>
        </div>
    <?php
    }
    ?>
    </div>
<div class="commentEntry">
   <form method="post" action="<?php echo $PHP_SELF;?>">
      <fieldset>
         <legend>Leave A Comment!</legend>
         <input type="hidden" name="comments" value="post" />
         <input type="hidden" name="p" value="<?php echo $p;?>" />
         <input type="hidden" name="parentid" value="<?php echo $p;?>" />
         <label for="author">Name</label>
         <input type="text" class="textEntry" value="<?php echo $author; ?>" name="author" id="author" size="36" />
         <label for="email">E-mail Address <strong>Will not be shared.</strong></label>
         <input type="text" class="textEntry" value="<?php echo $email; ?>" name="email" id="email" size="36" />
         <label for="url">Website</label>
         <input type="text" class="textEntry" value="<?php echo $url; ?>" name="url" id="url" size="36" />
         <?php if (!$action ) {$random = rand(1,9);} ?>
         <input type="hidden" name="random" value="<?php echo $random;?>" />
         <div style="width: 192px; height: 48px; background: url(admin/system/captcha.gif) no-repeat -<?php echo (48 * ($random - 1)); ?>px 0px;"></div>
         <label for="validation">Validation Code</label>
         <input type="text" class="textEntry" value="" name="randEntry" id="validation" size="36" />
         <label for="comment">Comment</label>
         <textarea name="comment" id="comment" class="textEntry" cols="50" rows="8"></textarea><br />
         <input type="submit" value="post comment" /><br class="noFloat" />
      </fieldset>
   </form>
</div>
<?php
   }
}
?>
